<?php
/*
 * Created on 08.01.2007
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

m2import('phpinchains/psp/Tag.php');

class example_iterationBodyProcessHandler extends phpinchains_psp_Tag
{

    /**
     * Is a body tag (if false, body is ignored)
     */
    var $tagType = PSP_ITERATION_TAG;
    /**
     * Tag name in form namespace:tagname
     */
    var $tagName   = 'example:iterationBodyProcess';
    
    var $count = 0;
    var $buffer = '';
    
    function doStartTag()
    {
        $this->count = $this->attrs['times'];
        return PSP_EVAL_BODY_BUFFERED;
    }

    function doAfterBody()
    {
        $this->count--;
        $this->buffer .= "<i>".$this->body->getBuffer()."</i><br/>";
        $this->body->clearBuffer();
        if ($this->count)
        {
            return PSP_EVAL_BODY_AGAIN;
        }
        return PSP_SKIP_BODY;
    }
    
    function doEndTag()
    {
        $this->out->write($this->buffer);
        $this->buffer = '';
        return PSP_SKIP_BODY;
    }
    
}
?>